package com.assistant.markdown;

import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * Markdown
 *
 * @author yingjianhua
 */
public class Markdown {

    @Getter
    private final List<Content> contents = new ArrayList<>();

    public Markdown append(Content content) {
        this.contents.add(content);
        return this;
    }

    public void print() {
        for (Content content : contents) {
            System.out.println(content);
            System.out.println();
        }
    }

    @Override
    public String toString() {
        StringBuilder stringBuilder = new StringBuilder();
        for (Content content : contents) {
            stringBuilder.append(content).append("\n");
        }
        return stringBuilder.toString();
    }
}
